<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript异步编程</title>
    <script src="./js06_sdync_block.js"></script>
    <link rel="stylesheet" href="../style/common.css">
</head>
<body>
    <h1>同步阻塞示例</h1>
    <p class="msg"></p>
    <p>
        <button>同步执行函数</button>
        <textarea name="" id="" cols="30" rows="10">
            点击“同步执行函数”后暂时无法响应，产生阻塞。
        </textarea>
    </p>
        <script>
            window.onload=function(){
            document.addEventListener("DOMContentLoaded",function(){
                let msg=document.querySelector(".msg");
                const btn=document.querySelector("button");
                btn.addEventListener("click",function(){
                    // const that=this;
                    done();
                    msg.innerHTML += "操作完成";
                    let pElem=document.createElement("p");
                    pElem.textContent = "新增段落";
                    document.body.appendChild(pElem);
                });
            });
        }
        </script>
   
</body>
</html>